#ifndef HELPER_H
#define HELPER_H

#include <Windows.h>
#include "tlib/twin.h"

#define HS_TOOLS		"HSTools"
#define IP_MSG			"IPMsg"
#define NO_NAME			"no_name"
#define URL_STR			"://"
#define MAILTO_STR		"mailto:"
#define MSG_STR			"msg"

#define UNIXTIME_BASE	((_int64)0x019db1ded53e8000)

inline time_t FileTime2UnixTime(FILETIME *ft) {
	return	(time_t)((*(__int64 *)ft - UNIXTIME_BASE) / 10000000);
}
inline void UnixTime2FileTime(time_t ut, FILETIME *ft) {
	*(__int64 *)ft = (__int64)ut * 10000000 + UNIXTIME_BASE;
}

time_t Time();
char* Ctime( SYSTEMTIME* st = NULL );

char* separate_token( char* buf, char separetor, char** handle );

bool GetLastErrorMsg( char *msg=NULL, TWin* win = NULL );
bool GetSockErrorMsg( char *msg=NULL, TWin* win = NULL );

ULONG ResolveAddr( const char* host );

#include "fileHelper.h"
#include "AppHelper.h"

#endif	// HELPER_H